<template>
  <div>
    <el-collapse v-model="activeNames" accordion>
      <el-collapse-item title="设备信息" name="ui">
        <el-form label-position="left" label-width="100px">
          <el-form-item label="设备名称">{{ data.info.deviceName }}</el-form-item>
          <el-form-item label="处理器">{{ data.info.cup }}</el-form-item>
          <el-form-item label="内存(RAM)">{{ data.info.ram }}</el-form-item>
          <el-form-item label="设备ID">{{ data.info.serial }}</el-form-item>
          <el-form-item label="硬盘ID">{{ data.info.hard }}</el-form-item>
          <el-form-item label="系统版本">{{ data.info.system }}</el-form-item>
          <el-form-item label="系统版本号">{{ data.info.version }}</el-form-item>
          <el-button icon="el-icon-switch" @click="handleClose">关机</el-button>
        </el-form>
      </el-collapse-item>
      <el-collapse-item title="广播" name="broastcast">
        <el-form label-width="68px">
          <el-form-item label="内容">
            <el-input type="textarea" v-model="data.broadcast.text"></el-input>
          </el-form-item>
          <el-form-item label="速率">
            <el-slider v-model="data.broadcast.speed" max="3" :marks="speedMarks" />
          </el-form-item>
          <el-form-item label="次数">
            <el-slider v-model="data.broadcast.time" max="3" :marks="timeMarks" />
          </el-form-item>
          <el-form-item>
            <el-button @click="handleBroadcast">广播</el-button>
          </el-form-item>
        </el-form>
      </el-collapse-item>
      <el-collapse-item title="API" name="api">
        <el-collapse-item title="信息" name="info">
        </el-collapse-item>
        <el-form>
          <el-form-item label="命令topic">LYW/cmnd/{{ code }}/control</el-form-item>
          <el-form-item label="关机">{power:{{ data.power }} }</el-form-item>
          <el-form-item label="广播">{broadcast:{{ data.broadcast }}}</el-form-item>
          <el-form-item label="信息">{info:{{ data.info }} }</el-form-item>
        </el-form>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>
<script>
  export default {
    name: 'WindowIotController',
    data() {
      return {
        activeNames: 'ui',
        code: 'computer_0001',
        speedMarks: {
          0: '慢',
          1: '中',
          2: '快',
          3: '迅速'
        },
        timeMarks: {
          0: '3次',
          1: '9次',
          2: '20次',
          3: '50次'
        },
        data: {
          power: 'ON',
          broadcast: {
            text: null,
            speed: 1,
            time: 2
          },
          info: {
            deviceName: 'PS2022YRZGLNGP',
            cup: '12th Gen Intel(R) Core(TM) i9-12900H 2.50 GHz',
            ram: '16.0 GB (15.6 GB 可用)',
            hard: '16.0 GB (15.6 GB 可用)',
            serial: '232FFEB8-1003-4CB5-A87F-1E51CB03A9C4',
            system: 'Windows 11 家庭中文版',
            version: '23H2'
          }
        },
      }
    },
    methods: {
      handleBroadcast() {

      },
      handleClose() {}
    }
  }

</script>
